package com.yowasa.xiuxian.engine.battle.strategy.drop.all;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.engine.battle.strategy.CalAbility;
import com.yowasa.xiuxian.engine.battle.strategy.InherentStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.BuffContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.entity.enums.InherentTiming;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;

@BS(name="雾切之威势")
@Order(1000)
@Component
public class WuQieWeiShi extends CalAbility implements InherentStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }
    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        BuffContent buff = second.getBuff().get("巴印");
        if (buff == null) {
            BuffContent buffContent = new BuffContent();
            buffContent.setDuration(5);
            buffContent.setNum(1);
            buffContent.setPositive(false);
            second.getBuff().put("巴印", buffContent);
        }else {
            buff.setDuration(5);
            int num=buff.getNum() + 1;
            buff.setNum(num);
        }

    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("该战技无法直接学习，需要拥有 武器-[雾切之回光] ，装备在身上时自动学会");

    }

    @Override
    public String limitDesc() {
        return "学习/使用雾切之威势需要拥有 武器-[雾切之回光] ";
    }

    @Override
    public boolean check(UserBattleContent user, BattleContent content) {
        return true;
    }

    @Override
    public String desc() {
        return "仿造的梦想一心打造的太刀，也沾染上了无想的威势\n你的每次行动都会为对方附上一层巴印，对方行动时将引爆巴印，每层造成攻击力*0.25的真实伤害，并为你回复此次伤害0.25的hp";
    }

    @Override
    public List<InherentTiming> getTiming() {
        return Lists.newArrayList(InherentTiming.SELF_END);
    }
}
